package petstore.domain;

public class Log {
    private String lastTime;
    private String username;
    private int cat;
    private int dog;
    private int bird;
    private int pokemon;
    private int bugCat;

    //单例模式
    private static Log log = new Log();

    //每次更新数据是调用此方法
    public void linkedCategoryUpdate(String categoryId)
    {
        if(categoryId.equals("cat")) this.cat++;
        if(categoryId.equals("dog")) this.dog++;
        if(categoryId.equals("bird")) this.bird++;
        if(categoryId.equals("pokemon")) this.pokemon++;
        if(categoryId.equals("bugCat")) this.bugCat++;
    }

    public static Log getInstance(){
        return log;
    }

    //私有构造方法
    private Log()
    {
        this.bugCat = 0;
        this.cat = 0;
        this.dog = 0;
        this.bird = 0;
        this.pokemon = 0;
    }
    /*
    public Log(String username, String lastTime,int cat,int dog,int bird,int pokemon,int bugCat)
    {
        this.username = username;
        this.lastTime = lastTime;
        this.cat = cat;
        this.dog = dog;
        this.bird = bird;
        this.pokemon = pokemon;
        this.bugCat = bugCat;
    }
     */

    //以下为get set方法
    public int getCat() {
        return cat;
    }

    public void setCat(int cat) {
        this.cat = cat;
    }

    public int getDog() {
        return dog;
    }

    public void setDog(int dog) {
        this.dog = dog;
    }

    public int getBird() {
        return bird;
    }

    public void setBird(int bird) {
        this.bird = bird;
    }

    public int getPokemon() {
        return pokemon;
    }

    public void setPokemon(int pokemon) {
        this.pokemon = pokemon;
    }

    public int getBugCat() {
        return bugCat;
    }

    public void setBugCat(int bugCat) {
        this.bugCat = bugCat;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getLastTime() {
        return lastTime;
    }

    public void setLastTime(String lastTime) {
        this.lastTime = lastTime;
    }

    public String toString()
    {
        return "username:" + username + " lastTime:" + lastTime ;
    }

    public void clear(){
        this.bugCat = 0;
        this.cat = 0;
        this.dog = 0;
        this.bird = 0;
        this.pokemon = 0;
    }
}
